package design.patterns.factory.method;

import org.junit.Test;

/**
 * @author daxue0929
 * @date 2023/4/12
 * 定义一个创建对象的接口，让子类决定实例化哪个产品类对象。工厂方法使一个产品类的实例化延迟到其工厂子类。
 */

public class Main {

    @Test
    public void main() {
        CoffeeStore coffeeStore = new CoffeeStore();
        coffeeStore.setFactory(new LatteCoffeeFactory());
        Coffee coffee = coffeeStore.orderCoffee();
        System.out.println(coffee.getName());
    }
}
